package com.thon.entity.system;


import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.thon.entity.util.IdEntity;

@Entity
@Table(name = "menu")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Menu extends IdEntity {
	
	private static final long serialVersionUID = -2882541081318874188L;
	private String name;
	private String description;
	private String link;
	private boolean leaf;
	private Integer level;
	private Menu parent;
	private Integer sort;
	private boolean enabled;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}	
	
	public String getDescription() {
		return description;
	}	
	
	public void setDescription(String description) {
		this.description = description;
	}
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	
	@ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY)	
	@JoinColumn(name="parent_id",nullable = false)
	@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
	public Menu getParent() {
		return parent;
	}
	public void setParent(Menu parent) {
		this.parent = parent;
	}
	public Integer getSort() {
		return sort;
	}
	public void setSort(Integer sort) {
		this.sort = sort;
	}
	public boolean isEnabled() {
		return enabled;
	}
	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}	

	public String getLink() {
		return link;
	}
	public void setLink(String link) {
		this.link = link;
	}
	public boolean isLeaf() {
		return leaf;
	}
	public void setLeaf(boolean leaf) {
		this.leaf = leaf;
	}
	
	
	
	
	
	
	
}
